package com.ruoyi.web.controller.task;

import com.ruoyi.system.biz.MerchantCountBizService;
import com.ruoyi.system.biz.UserCountBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
@ConditionalOnProperty(value = "spring.profiles.active", havingValue = "prod")
public class CountOrderTask {

    private final UserCountBizService userCountBizService;
    private final MerchantCountBizService merchantCountBizService;
    //每天凌晨 过一分 统计商户昨日数据


    //每天凌晨1点30分统计前一日数据
    @Scheduled(cron = "0 30 1 * * ? ")
    public void countUserCount() {
        userCountBizService.addUserCount();

    }


    //每天凌晨0点30分统计前一日数据
    @Scheduled(cron = "0 30 0 * * ? ")
    public void countMerchantCount() {
        merchantCountBizService.addUserCount();

    }


}
